package com.yxw.bamboo.api.dao;

import com.yxw.bamboo.core.NetworkContext;
import com.yxw.bamboo.core.database.sql.MockData;
import org.apache.ibatis.annotations.*;
import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

@Mapper
public interface HostMapper {
    @Select("select a.id as id, a.sql_type," +
            "       a.host_status,a.code_type," +
            "       a.local_port," +
            "       a.remote_host_addr," +
            "       a.remote_host_port," +
            "       a.ssl," +
            "       a.local_host_addr," +
            "a.is_removed" +
            " from host as a where a.is_removed=0 and a.id>#{id}")
    @Results(id="network_data",value = {
            @Result(id=true,column = "id",property = "id"),
            @Result(id=false,column = "sll",property = "sll"),
            @Result(id=false,column = "sql_type",property = "sqlType"),
            @Result(id=false,column = "local_port",property = "localPort"),
            @Result(id=false,column = "remote_host_port",property = "remoteHostPort"),
            @Result(id=false,column = "remote_host_addr",property = "remoteHostAddr"),
            @Result(id=false,column = "local_host_addr",property = "localHostAddr"),
            @Result(id=false,column = "code_type",property = "codeType")
    })
    List<NetworkContext> findAllHostInfo(@Param("id") int maxId);


}
